﻿using Learun.Util;
using SqlSugar;
using System;
namespace Learun.Application.TwoDevelopment.ZZDT_EC

{
    /// <summary>
    /// 版 本 PIT-ADMS V7.0.3 敏捷开发框架
    /// Copyright (c) 2013-2018 Hexagon PPM
    /// 创 建：超级管理员
    /// 日 期：2022-06-21 15:32
    /// 描 述：Connection，terminal和wire之间的连接关系。
    /// </summary>
    [SugarTable(TableName = "ec_Wire_Terminal")]
    public class ec_WireTerminalEntity
    {
        public ec_WireTerminalEntity()
        {
            NeedRemove = false;
        }
        #region 实体成员
        /// <summary>
        /// ID
        /// </summary>
        /// <returns></returns>
        [SugarColumn(IsPrimaryKey = true)]
        public string ID { get; set; }
        /// <summary>
        /// WireID，对应<see cref="ec_CableSetWireEntity.WireID"/>
        /// </summary>
        /// <returns></returns>
        public string WireID { get; set; } = "";
        /// <summary>
        /// ID
        /// </summary>
        /// <returns></returns>
        //public string PanelID { get; set; } = "";
        /// <summary>
        /// CableSetID
        /// </summary>
        /// <returns></returns>
        //public string StripID { get; set; } = "";
        /// <summary>
        /// TermID，对应<see cref="ec_PanelStripTermEntity.TermID"/>
        /// </summary>
        /// <returns></returns>
        public string TermID { get; set; } = "";

        /// <summary>
        /// 暂时没用到。相当于信号流里的前后顺序。可以用100来说明这个是接到了DCS卡件上
        /// </summary>
        /// <returns></returns>
        public int Group_Seq { get; set; }
        /// <summary>
        /// 电缆哪一端被连接（0左，1右）。暂时没用到
        /// </summary>
        /// <returns></returns>
        public int Cable_Side { get; set; }
        /// <summary>
        /// 端子排哪一侧被连接（0左，1右）。暂时没用到
        /// </summary>
        /// <returns></returns>
        public int Strip_Side { get; set; }

        /// <summary>
        /// 走的信号是什么<see cref="ec_Wire_GroupEntity.Wire_Group_ID"/>。暂时没用到
        /// </summary>
        /// <returns></returns>
        public string Wire_Group_ID { get; set; } = "";
        /// <summary>
        /// 创建人
        /// </summary>
        /// <returns></returns>
        public string CreateUserID { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        /// <returns></returns>
        public DateTime? CreateTime { get; set; }
        /// <summary>
        /// 更新人
        /// </summary>
        /// <returns></returns>
        public string UpdateUserID { get; set; }
        /// <summary>
        /// 更新时间
        /// </summary>
        /// <returns></returns>
        public DateTime? UpdateTime { get; set; }
        #endregion

        #region 扩展操作
        /// <summary>
        /// 新增调用
        /// </summary>
        public void Create()
        {
            this.ID = Guid.NewGuid().ToString();
            this.CreateTime = Time.MySqlTime;
            UserInfo userInfo = LoginUserInfo.Get();
            this.CreateUserID = userInfo.userId;


        }
        /// <summary>
        /// 编辑调用
        /// </summary>
        /// <param name="keyValue"></param>
        public void Modify(string keyValue)
        {
            this.ID = keyValue;
            this.UpdateTime = Time.MySqlTime;
            UserInfo userInfo = LoginUserInfo.Get();
            this.UpdateUserID = userInfo.userId;
        }
        #endregion

        #region 扩展字段

        /// <summary>
        /// 依靠这个来决定Delete或者Save
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public bool NeedRemove { get; set; }

        [SugarColumn(IsIgnore = true)]
        public string PanelName { get; set; }
        [SugarColumn(IsIgnore = true)]
        public string StripName { get; set; }
        [SugarColumn(IsIgnore = true)]
        public string Term_No { get; set; }
        [SugarColumn(IsIgnore = true)]
        public int Term_Seq { get; set; }

        [SugarColumn(IsIgnore = true)]
        public string CableName { get; set; }

        [SugarColumn(IsIgnore = true)]
        public string CableSetName { get; set; }


        /// <summary>
        /// CableSetID(取消了，不如cableset表里也有一个，增加难度)，但是saveconnection时似乎还要用到
        /// </summary>
        /// <returns></returns>
        [SugarColumn(IsIgnore = true)]
        public string CableSetID { get; set; } = "";



        [SugarColumn(IsIgnore = true)]
        public int CableSetSeq { get; set; }

        [SugarColumn(IsIgnore = true)]
        public string Wire_Tag { get; set; }
        [SugarColumn(IsIgnore = true)]
        public string Polarity { get; set; }
        [SugarColumn(IsIgnore = true)]
        public int SetLevel { get; set; }
        #endregion
    }
}

